package team.sun.sss.dao.log;


import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface NotifyDao {
    @Select("select * from notify where user_id = #{user_id};")
    List<Map<String,Object>> getNotifyList(@Param("user_id") int user_id);

    @Delete("delete from notify where FIND_IN_SET (notify_Id,#{notify_Id_arr});")
    int deleteNotify(@Param("notify_Id_arr") String notify_Id_arr);

    @Update("update notify set state = '已读' where FIND_IN_SET (notify_Id,#{notify_Id_arr})")
    int updateNotify(@Param("notify_Id_arr") String notify_Id_arr);

    @Update("update notify set state = '未读' where FIND_IN_SET (notify_Id,#{notify_Id_arr})")
    int updateNotify2(@Param("notify_Id_arr") String notify_Id_arr);

    @Insert("insert into notify(user_id,title,content,sender,state) values(#{user_id},#{title},#{content},#{sender},'未读')")
    int addStuNotify(int user_id, String title, String content, String sender);

    @Insert("insert into notify(user_id,title,content,sender,state) values(#{user_id},#{title},#{content},#{sender},'未读')")
    int addIntNotify(int user_id, String title, String content, String sender);

}
